package com.hyh.shiyanshiguanli.mapper;

import com.github.pagehelper.Page;
import com.hyh.shiyanshiguanli.domain.dto.PublicInformationDTO;
import com.hyh.shiyanshiguanli.domain.dto.PublicInformationUpdateDTO;
import com.hyh.shiyanshiguanli.domain.entity.Admin;
import com.hyh.shiyanshiguanli.domain.entity.PublicInformation;
import org.apache.ibatis.annotations.*;

/**
 * @author hyh
 * @version 1.0
 */
@Mapper
public interface PublicInformationMapper {
    /**
     * 公告的分页查询
     * @param publicInformationDTO
     * @return
     */
    Page<PublicInformation> page(PublicInformationDTO publicInformationDTO);

    /**
     * id查询
     * @param id
     * @return
     */
    @Select("select * from public_information where id = #{id}")
    PublicInformation selectById(Integer id);

    /**
     * 根据id更新
     * @param publicInformationUpdateDTO
     */
    void updateById(PublicInformationUpdateDTO publicInformationUpdateDTO);

    /**
     * 添加公告
     * @param publicInformation
     */
    @Insert("insert into public_information (title, content, create_time, create_people)" +
            "values (#{title},#{content},#{createTime},#{createPeople})")
    void add( PublicInformation publicInformation);

    /**
     * 根据id删除
     * @param id
     */
    @Delete("delete from public_information where id = #{id}")
    void deleteById(@Param("id") Integer id);
}
